<?php  
/** 
 * 日志类 
 * 
 * @package    log 
 * @version 
 */  
class Logger
{   
    /** 
     * 写日志 
     * 
     * @param string $s_message 日志信息 
     * @param string $s_type    日志类型 
     */  
    public static function write($s_message, $s_level = 'debug')  
    {  
		$requestInfomation = $_SERVER['REMOTE_ADDR'].','.$_SERVER['HTTP_USER_AGENT'].', http://'.$_SERVER['HTTP_HOST'].htmlentities($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING']."\n";
        // 设置日志输出文件
        $s_logfile = RootPath.'/log/log_'.date('Ymd').'.log';
		$s_logmsg = "\n".date('[Y-m-d H:i:s]').' - '. $s_level . ' - ' .$requestInfomation . $s_message;
        // 写日志
		file_put_contents($s_logfile, $s_logmsg, FILE_APPEND);
    }
	
	public static function debug($s_message) 
	{
		self::write($s_message, 'debug');
	}
	
	public static function info($s_message) 
	{
		self::write($s_message, 'info');
	}
	
	public static function warm($s_message) 
	{
		self::write($s_message, 'warm');
	}
	
	public static function error($s_message) 
	{
		$self::write($s_message, 'error');
	}
}